﻿<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <!--edge浏览器H5兼容设置-->
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <!--360浏览器H5兼容设置-->
    <meta name="renderer" content="webkit"/>
    <title>修改密码</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!--导入核心文件-->
    <script src="../bootstrap3/js/holder.js"></script>
    <link href="../bootstrap3/css/bootstrap.css" rel="stylesheet" type="text/css">
    <script src="../bootstrap3/jquery-1.9.1.min.js"></script>
    <script src="../bootstrap3/js/bootstrap.js"></script>
    <!-- 字体图标 -->
    <link rel="stylesheet" href="../bootstrap3/font-awesome-4.7.0/css/font-awesome.css"/>
    <style type="text/css">
    html,body{width:100%;height:100%;}
    body{margin:0px auto;padding:0px auto;background:#abb9c4;color:#10273f}
</style>
</head>

<body>
<div class="container">
    <div class="panel-body">
        <!--修改密码表单开始-->
        <form class="form-horizontal" role="form" id="form-change-password">
            <div class="form-group">
                <label class="col-md-2 control-label">原密码：</label>
                <div class="col-md-8">
                    <input type="text" class="form-control" placeholder="请输入原密码" name="old_password">
                </div>
            </div>
            <div class="form-group">
                <label class="col-md-2 control-label">新密码：</label>
                <div class="col-md-8">
                    <input type="text" class="form-control" placeholder="请输入新密码" name="new_password">
                </div>
            </div>
            <div class="form-group">
                <label class="col-md-2 control-label">确认密码：</label>
                <div class="col-md-8">
                    <input type="text" class="form-control" placeholder="请再次输入新密码">
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-offset-2 col-sm-10">
                    <input type="button" class="btn btn-primary" value="修改" id="btn-change-password"/>
                </div>
            </div>
        </form>
    </div>
</div>
<script type="text/javascript">
    $("#btn-change-password").click(function () {
        $.ajax({
            "url": "/admin/change_password",
            "data": $("#form-change-password").serialize(),
            "type": "post",
            "dataType": "json",
            "success": function (json) {
                if (json.state === 2000) {
                    alert("修改成功！");
                } else {
                    alert("修改失败！" + json.message);
                }
            },
            "error": function () {
                alert("您的登录信息已过期！请重新登录");
                //location.href="login.html";
            }
        });
    });
</script>
</body>

</html>